Speed up large XML parses#12917
Conversation
Creating the children array and attribute map for nodes that will never use it (text nodes, etc) is both wasteful in terms of RAM and in terms of time. Parsing a 400MB XML file this small change saves me a full second of time in benchmarks.
|
Probably one of the few places where inheritance would really make sense: Have one subclass for trees (documents and elements) and one for leafs (the rest). This would replace all the node type conditionals with polymorphism and also make smaller instances on static targets (even if fields are |
|
Sure, inheritance or enum could make sense. Would have to benchmark to see the impact. This small change has a good performance impact without any API changes though. |
|
Surely this should use a |
|
@Simn for what specifically? It's two overlapping conditions... |
|
Does this have an effect on the null safety invariants of this class? |
Sorry, what? |
|
The I was wondering if making it |
|
Haxe std is only trying to be null-safe as external interface right now, not by implementation. Marking type as nullable should be correct change (since this is also public field) |
Creating the children array and attribute map for nodes that will never use it (text nodes, etc) is both wasteful in terms of RAM and in terms of time. Parsing a 400MB XML file this small change saves me a full second of time in benchmarks.